﻿<%@ Page Language="C#" %>
<%@ Import Namespace= "System.Collections"%>
<%@ Import Namespace="System.Collections.Generic" %>

<% 
    
    List<DTO.LoaiSanPhamDto> dsLoai = BUS.LoaiSanPhamBus.LayDanhSachLoaiSanPham();
    if (Request["key"] != null)
        dsLoai = BUS.LoaiSanPhamBus.LayLoaiSanPhamTheoKey(Request["key"]);
    Response.Write("<?xml version='1.0' encoding='utf-8'?>");
    Response.Write("<root>");
    Response.Write("<total>" + dsLoai.Count + "</total>");
    Response.Write("<listloaisanpham>");
    foreach (DTO.LoaiSanPhamDto loaisp in dsLoai)
    {
        Response.Write("<loaisanpham>");
        Response.Write("<id>" + loaisp.ID + "</id>");
        Response.Write("<tenloai><![CDATA[" + loaisp.TenLoaiSanPham + "]]></tenloai>");
        Response.Write("</loaisanpham>");
        
    }
    Response.Write("</listloaisanpham>");
    Response.Write("</root>");
%>